<?php 

namespace app\controller\appPage;

use app\exception\ErrnoPlus;
use Exception;
use share\controller\PageBaseController;
use share\exception\PageException;
use share\service\AliCloudService;
use share\utils\Helper;

class DataflowController extends PageBaseController{

    public function initValidate(){    
    }

    /**
     * 4g流量  详情页
     */
    public function detail_action(){
        $info = [
            "used" => "",
            "round" => "0%",
            "iccid" => "",
            "opType" => "",
            "total" => "",
            "deadline" => "",
            "status" => "",
            "model" => 0,
            "msg" => "",
            "active" => 0
        ];
        $simId = $this->request->param("simId");
        if(empty($simId)){
            $info["msg"] = "卡号异常";
            return self::ok(['info' =>  $info]);
        }
        $info["iccid"] = $simId;
        try{
            $resp = AliCloudService::querySimInfo([
                "simId" => $simId,
            ]);
            $info = array_merge($info,$resp);
        }
        catch(Exception $e){
            $info['msg'] = $e->getMessage();            
        } 
        return self::ok(['info' =>  $info]);
    }
 

}